﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DataGrid自定义分页.aspx.cs" Inherits="DataGrid自定义分页"  %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body style="color: gray; font-family: Arial;font-size:9pt;">
    <form id="form1" runat="server">
    <div>
        DataGrid自定义分页<br />
        <br />
    
    <asp:DataGrid runat="server" ID="Gridx" AllowCustomPaging="True" AllowPaging="True" AutoGenerateColumns="False" ShowHeader="False" PageSize="2">
        <AlternatingItemStyle BackColor="Gainsboro" />
        <Columns>
            <asp:BoundColumn DataField="newsid" HeaderText="ID"></asp:BoundColumn>
            <asp:BoundColumn DataField="title" HeaderText="Title"></asp:BoundColumn>
            <asp:BoundColumn DataField="Content" HeaderText="Content"></asp:BoundColumn>
        </Columns>
        <PagerStyle Visible=False HorizontalAlign=Right Mode=NumericPages ForeColor="#404040" />
    </asp:DataGrid><!--定义 上一页 下一页  -->
    <div style="width: 148px; height: 21px">
    
        <asp:LinkButton ID="PageFirst" runat="server" CommandArgument="First" OnClick="PageButtonClick">首页</asp:LinkButton>
        <asp:LinkButton ID="PageUp" runat="server" CommandArgument="prev" OnClick="PageButtonClick">上一页</asp:LinkButton>
        <asp:LinkButton ID="PageNext" runat="server" CommandArgument="next"  OnClick="PageButtonClick" >下一页</asp:LinkButton>
        <asp:LinkButton ID="PageLast" runat="server" CommandArgument="last" OnClick="PageButtonClick">尾页</asp:LinkButton>
        
        </div>
    </div>
    
    </form>
</body>
</html>
